﻿<template>
    <div class="esChannelOrder-container">
        <el-dialog v-model="state.isShowDialog" draggable width="769px">
            <template #header>
                <div style="color: #fff">
                    <el-icon size="16" style="margin-right: 3px; display: inline; vertical-align: middle">
                        <ele-Edit/>
                    </el-icon>
                    <span> {{ props.title }} </span>
                </div>
            </template>
            <el-form :model="state.ruleForm" ref="ruleFormRef" size="default" label-width="80px">
                <el-row :gutter="35">
                    <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
                        <el-form-item label="商户名称" prop="merchantId">
                            <el-input :value="state.ruleForm.merchantName" class="w100" readonly/>
                        </el-form-item>
                    </el-col>
                    <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
                        <el-form-item label="渠道名称" prop="channelId">
                            <el-input :value="state.ruleForm.channelName" class="w100" readonly/>
                        </el-form-item>
                    </el-col>
                    <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
                        <el-form-item label="产品名称" prop="productId">
                            <el-input :value="state.ruleForm.productName" class="w100" readonly/>
                        </el-form-item>
                    </el-col>
                    <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
                        <el-form-item label="手机号码" prop="phone">
                            <el-input :value="state.ruleForm.phone" class="w100" readonly/>
                        </el-form-item>
                    </el-col>
                    <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
                        <el-form-item label="省-市" prop="province">
                            <el-input
                                :value="`${state.ruleForm.province || ''}-${state.ruleForm.city ? state.ruleForm.city : ''}`"
                                placeholder="省-市" class="w100" readonly/>
                        </el-form-item>
                    </el-col>
                    <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
                        <el-form-item label="信息费" prop="informationFee">
                            <el-input :value="state.ruleForm.informationFee" placeholder="请输入信息费" class="w100"
                                      readonly/>
                        </el-form-item>
                    </el-col>
                    <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
                        <el-form-item label="渠道结算" prop="channelSettlementPrice">
                            <el-input :value="state.ruleForm.channelSettlementPrice" placeholder="请输入渠道结算价格"
                                      class="w100" readonly/>
                        </el-form-item>
                    </el-col>
                    <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
                        <el-form-item label="透传数据" prop="extData">
                            <el-input :value="state.ruleForm.extData" placeholder="无透传数据" class="w100" readonly/>
                        </el-form-item>
                    </el-col>
                    <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
                        <el-form-item label="订单状态" prop="orderStatus">
                            <el-select v-model='state.ruleForm.orderStatus' class="w100" disabled>
                                <el-option v-for='item in optionDict.orderStatusDict' :key='item.value'
                                           :label='item.label'
                                           :value='item.value'/>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
                        <el-form-item label="同步状态" prop="syncStatus">
                            <el-select v-model='state.ruleForm.syncStatus' class="w100" disabled>
                                <el-option v-for='item in optionDict.syncStatusDict' :key='item.value'
                                           :label='item.label'
                                           :value='item.value'/>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
                        <el-form-item label="同步次数" prop="syncCount">
                            <el-input :value="state.ruleForm.syncCount" placeholder="同步次数" class="w100" readonly/>
                        </el-form-item>
                    </el-col>
                    <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
                        <el-form-item label="商户订单" prop="merchantOrderId">
                            <el-input :value="state.ruleForm.merchantOrderId" class="w100" readonly/>
                        </el-form-item>
                    </el-col>
                    <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
                        <el-form-item label="外部订单" prop="outOrderId">
                            <el-input :value="state.ruleForm.outOrderId" class="w100" readonly/>
                        </el-form-item>
                    </el-col>
                    <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
                        <el-form-item label="订单描述" prop="orderMessage">
                            <el-input :value="state.ruleForm.orderMessage" class="w100" readonly/>
                        </el-form-item>
                    </el-col>
                    <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
                        <el-form-item label="同步链接" prop="syncUrl">
                            <el-input :value="state.ruleForm.syncUrl" type="textarea" placeholder="无同步链接"
                                      class="w100" style="word-break: break-all;" :autosize="{ minRows: 2 }" readonly/>
                        </el-form-item>
                    </el-col>
                    <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
                        <el-form-item label="同步时间" prop="syncTime">
                            <el-input :value="state.ruleForm.syncTime" class="w100" readonly/>
                        </el-form-item>
                    </el-col>
                    <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
                        <el-form-item label="响应结果" prop="syncResponse">
                            <el-input :value="state.ruleForm.syncResponse" class="w100" readonly/>
                        </el-form-item>
                    </el-col>

                    <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
                        <el-form-item label="备注" prop="remark">
                            <el-input :value="state.ruleForm.remark" type="textarea" placeholder="无备注" class="w100"
                                      readonly/>
                        </el-form-item>
                    </el-col>
                </el-row>
            </el-form>
            <template #footer>
				<span class="dialog-footer">
					<el-button type="primary" @click="closeDialog" size="default">关 闭</el-button>
				</span>
            </template>
        </el-dialog>
    </div>
</template>

<script lang="ts" setup name="editEsChannelOrder">

import {reactive, ref} from 'vue';
import mittBus from '/@/utils/mitt';

import {EsChannelOrder} from '/@/api/models';
import {optionDict} from "/@/const/dict";

// 定义变量内容
const props = defineProps({
    title: String,
});
const ruleFormRef = ref();
const state = reactive({
    isShowDialog: false,
    ruleForm: {} as EsChannelOrder,
});

// 打开弹窗
const openDialog = (row: EsChannelOrder) => {
    state.ruleForm = row;
    state.isShowDialog = true;
};

// 关闭弹窗
const closeDialog = () => {
    mittBus.emit('submitRefresh');
    state.isShowDialog = false;
};

// 导出对象 将属性或者函数暴露给父组件
defineExpose({openDialog});
</script>
